<Project Sdk="Microsoft.Build.Traversal">

  <PropertyGroup Condition="'$(BuildTargetFramework)' != '' and '$(BuildTargetFramework)' == '$(NetFrameworkCurrent)'">
    <TargetFramework>$(BuildTargetFramework)</TargetFramework>
    <!-- Filter ProjectReferences to build the best matching target framework only. -->
    <FilterTraversalProjectReferences>true</FilterTraversalProjectReferences>
  </PropertyGroup>

  <!-- Reference all out-of-band projects. -->
  <ItemGroup>
    <ProjectReference Include="$(MSBuildThisFileDirectory)*\src\*.*proj"
                      Exclude="@(ProjectExclusions);
                               $(MSBuildThisFileDirectory)*\src\**\*.shproj;
                               shims\src\*.csproj" />

    <!-- During an official build, build the identity package only in the allconfigurations build, otherwise always. -->
    <ProjectReference Include="$(MSBuildThisFileDirectory)*\pkg\runtime.native.*.proj"
                      Condition="'$(SkipLibrariesNativeRuntimePackages)' != 'true' and
                                 (
                                  '$(BuildingAnOfficialBuildLeg)' != 'true' or
                                  '$(BuildAllConfigurations)' == 'true'
                                 )" />

    <!-- Build these packages in the allconfigurations leg only. -->
    <ProjectReference Remove="Microsoft.Internal.Runtime.AspNetCore.Transport\src\Microsoft.Internal.Runtime.AspNetCore.Transport.proj;
                              Microsoft.Internal.Runtime.WindowsDesktop.Transport\src\Microsoft.Internal.Runtime.WindowsDesktop.Transport.proj;
                              Microsoft.Internal.Runtime.DotNetApiDocs.Transport\src\Microsoft.Internal.Runtime.DotNetApiDocs.Transport.proj"
                      Condition="'$(BuildAllConfigurations)' != 'true'" />

    <!-- Skip these projects during source-build as they rely on external prebuilts. -->
    <ProjectReference Remove="Microsoft.Extensions.DependencyInjection.Specification.Tests\src\Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj"
                      Condition="'$(DotNetBuildSourceOnly)' == 'true'" />
  </ItemGroup>

</Project>
